@extends('layouts.admin')
@section('content')
        <!--面包屑导航 开始-->
<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{{ url('admin/info') }}">首页</a> &raquo; 文章管理列表
</div>
<!--面包屑导航 结束-->

<!--结果页快捷搜索框 开始-->
<div class="search_wrap">
    <form action="{!! url('/admin/article/search') !!}" method="post">
        <table class="search_tab">
            <tr>
                <th width="120">选择分类:</th>
                <td>
                    <select name="categroy_id">
                        <option value="0">全部</option>
                        <option value="http://www.baidu.com">百度百度</option>
                        <option value="http://www.sina.com">新浪</option>
                    </select>
                </td>
                <th width="70">关键字:</th>
                <td><input type="text" name="keywords" placeholder="关键字"></td>
                <td><input type="submit" value="查询"></td>
            </tr>
        </table>
        {{ csrf_field() }}
    </form>
</div>
<!--结果页快捷搜索框 结束-->

<!--搜索结果页面 列表 开始-->
<form action="#" method="post">
    <div class="result_wrap">
        <!--快捷导航 开始-->
        <div class="result_content">
            <div class="short_wrap">
                <a href="{!! url('/admin/article/create') !!}"><i class="fa fa-plus"></i>新增文章</a>
                <a href="{!! url('/admin/article') !!}"><i class="fa fa-fw fa-list-ul"></i>文章列表</a>
            </div>
        </div>
        <!--快捷导航 结束-->
    </div>

    <div class="result_wrap">
        <div class="result_content">
            <table class="list_tab">
                <tr>
                    <th class="tc" width="40">ID</th>
                    <th>标题</th>
                    <th>审核状态</th>
                    <th>所属分类</th>
                    <th>点击</th>
                    <th>发布人</th>
                    <th>更新时间</th>
                    <th>至首页</th>
                    <th width="80">操作</th>
                </tr>

                @foreach($date as $vo)
                <tr>
                    <td class="tc">{!! $vo->id !!}</td>
                    <td>
                        <a target="_blank" href="{!! url('/article/'.$vo->id.'.shtml') !!}">{!! str_limit($vo->name, $limit = 60, $end = '...') !!}</a>
                    </td>
                    <td>
                        @if($vo->status == 0)
                            待审核
                        @elseif($vo->status == -1)
                            审核失败
                        @else
                            审核成功
                        @endif
                    </td>
                    <td>{!! $vo->pid !!}</td>
                    <td>{!! $vo->tips !!}</td>
                    <td>{!! $vo->editor !!}</td>
                    <td>{!! $vo->updated_at !!}</td>
                    <td>
                        {!! $vo->getIsShow($vo->is_index) !!}
                        {{--@if($vo->is_index == 1)--}}
                            {{--是--}}
                        {{--@else--}}
                            {{--否--}}
                        {{--@endif--}}
                    </td>
                    <td>
                        <a href="{{ url('/admin/article/'.$vo->id.'/edit') }}">修改</a>
                        <a href="javascript:;" onclick="deleteId({{ $vo->id }})">删除</a>
                    </td>
                </tr>
                @endforeach
            </table>
            <div class="page_list">
                {!! $date !!}
            </div>
        </div>
    </div>
</form>
<!--搜索结果页面 列表 结束-->
<script type="text/javascript">
    function deleteId(id){
        $.ajax({
            url:"{!! url('/admin/article') !!}/" + id,
            data:{'_method':'delete','_token':"{!! csrf_token() !!}"},
            type:'post',
            dataType:'json',
            beforeSend:function(){
                layer.load();
            },
            success:function(data){

                layer.closeAll('loading');
                if(data.status==1){
                    layer.msg(data.msg, {icon: 6});
                    setTimeout(function(){
                        location.href = location.href;
                    },2000);
                }else{
                    layer.msg(data.msg, {icon: 5});
                }
            }
        });
    }
</script>
@endsection
@section('js')
<script type="text/javascript" src="{!! url('backsted/layer/layer.js') !!}"></script>
@endsection
